﻿@model QDT.Core.Payments.PaymentNotice
@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
	    <title> 众禧贷</title>
	    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
	    <meta charset="UTF-8"/>
	</head>
	
    <body>
        <form id="offline_pay_form" action="@Url.Action("OfflineNotice", "Payment")" class="hide" method="POST">
            @Html.AntiForgeryToken()
            <input type="hidden" name="NoticeSn" value="@Model.NoticeSn"/>
            <input type="hidden" name="Money" value="@Model.Money.ToString("0.00")"/>
            <input type="hidden" id="PayCode" name="PayCode" value="-9"/>
            <input type="hidden" id="CodeExplain" name="CodeExplain" value=""/>
        </form>
    </body>
    
    <script type="text/javascript" src="@Url.Content("~/Content/Default/JS/jquery.min.js")"> </script>
    <script type="text/javascript">

        function charge() {
            try {
                var request = new ActiveXObject("ALLINPAY.RequestData");
                var response = new ActiveXObject("ALLINPAY.ResponseData");
                var mis = new ActiveXObject("ALLINPAY.MisPos");

                request.putValue("transtype", "32");
                request.putValue("cardtype", "01");
                request.putValue("amount", "@(Model.Money.ToString("0.00"))");
                request.putValue("preDef_0", "@ViewBag.Name");
                request.putValue("preDef_1", "@Model.NoticeSn");

                mis.TransProcess(request, response);

                $("#PayCode").val(response.getValue("rejcode"));
                $("#CodeExplain").val(response.getValue("RejCodeExplain"));

//                $("#PayCode").val("0");
//                $("#CodeExplain").val("交易成功");

                request = null;
                response = null;
                mis = null;

                $("#offline_pay_form").submit();

            } catch (err) {
                alert("错误描述: " + err.description);
            } 
        }

        $(document).ready(function() {
            charge();
        });

    </script>

</html>